#pragma once

#include <web/Socket.h>

namespace Web
{
    struct UdpSocket : public Web::Socket, public Web::SockAddrIn
    {

        UdpSocket(){

            InitUdp();
        };
    
        UdpSocket(int fd)
        {
            this->fd = fd;
            GetPeerNameFromFd();
        };

        int GetPeerNameFromFd()
        {
            SOCKLEN peer_addr_len = sizeof(struct sockaddr_in);
            return getpeername(fd, this->GetSockAddr(), &peer_addr_len);
        }
    };

};